﻿using DevExpress.XtraGrid.Demos.util;
using DevExpress.XtraLayout;
using DXApplicationTangche.DTO;
using mendian;
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using static DXApplicationTangche.UC.纳客.Form新建报表;

namespace DXApplicationTangche.Utils.UC
{
    public class nakeService
    {
        public static List<SaleOrderFacadeDTO> getUnPushSaleOrderFacade()
        {
            return
                FunctionHelper.JsonDeserialization<List<SaleOrderFacadeDTO>>(
                    RestCall.httpGetMethod(
                       "http://8.130.16.179:8090/nakeKingDee/getUnPushSaleOrderFacade"
                    )
                );
        }
        /// <summary>
        /// 查询对应组织下的未下推销售订单
        /// </summary>
        /// <param name="orgId"></param>
        /// <returns></returns>
        public static List<SaleOrderFacadeDTO> getUnPushSaleOrderFacadeByOrgId(String orgId)
        {
            return
                FunctionHelper.JsonDeserialization<List<SaleOrderFacadeDTO>>(
                    RestCall.httpGetMethod(
                       "http://8.130.16.179:8090/nakeKingDee/getUnPushSaleOrderFacadeByOrgId?orgId=" + orgId
                    )
                );
        }
        public static SaleOrderFacadeDTO modifyDisconut(String id, String entryId, Double adjustDiscount)
        {
            return
                FunctionHelper.JsonDeserialization<SaleOrderFacadeDTO>(
                    RestCall.httpGetMethod(
                       "http://8.130.16.179:8090/nakeKingDee/modifyDisconut?id=" + id + "&entryId=" + entryId + "&adjustDiscount=" + adjustDiscount
                    )
                );
        }
        public static SaleOrderFacadeDTO pushSalOrder(String id)
        {
            SaleOrderFacadeDTO saleOrderFacadeDTO =
                   FunctionHelper.JsonDeserialization<SaleOrderFacadeDTO>(
                       RestCall.httpGetMethod(
                          "http://8.130.16.179:8090/nakeKingDee/pushSalOrder?id=" + id
                       )
                   );
            return saleOrderFacadeDTO;
        }
        public static List<SaleOrderFacadeDTO> getPushSaleOrderFacade()
        {
            return
                FunctionHelper.JsonDeserialization<List<SaleOrderFacadeDTO>>(
                    RestCall.httpGetMethod(
                       "http://8.130.16.179:8090/nakeKingDee/getPushSaleOrderFacade"
                    )
                );
        }
        /// <summary>
        /// 查询对应组织下的已经下推销售订单
        /// </summary>
        /// <param name="orgId"></param>
        /// <returns></returns>
        public static List<SaleOrderFacadeDTO> getPushSaleOrderFacadeByOrgId(String orgId)
        {
            return
                FunctionHelper.JsonDeserialization<List<SaleOrderFacadeDTO>>(
                    RestCall.httpGetMethod(
                       "http://8.130.16.179:8090/nakeKingDee/getPushSaleOrderFacadeByOrgId?orgId=" + orgId
                    )
                );
        }
        /// <summary>
        /// 用户登录
        /// </summary>
        /// <param name="userName"></param>
        /// <param name="password"></param>
        /// <returns></returns>
        public static NakeSignInDao nakeSignIn(String userName, String password)
        {
            return
                FunctionHelper.JsonDeserialization<NakeSignInDao>(
                    RestCall.httpGetMethod(
                       "http://8.130.16.179:8090/nakeKingDee/nakeSignIn?userName=" + userName + "&password=" + password
                    )
                );
        }
        
    }
    public class NakeSignInDao
    {
        public String orgId { get; set; }
        public String orgName { get; set; }
        public String userName { get; set; }
        public String password { get; set; }
        public NakeSignInDao()
        {

        }
    }
}
